<?php
/**
 * Created by PhpStorm.
 * User: wx:wenyi2048
 * Date: 2022/3/19 0019
 * Time: 16:45
 */

namespace app\common\service;


class BannersService extends Service
{
    protected $tableName = 'sms_mk_banners';

    public function dbList($isdelete = 0,$position='first',$status=1){
        $this->db->alias('b')
            ->join('sms_mk_types t','t.id = b.types_third_id','left')
            ->where('b.isdelete','=',$isdelete)
            ->where('b.status','=',$status)
            ->field('b.*,t.name as types_third_text');
        if($position){
            $this->db->where('b.position','=',$position);
        }else{
            $this->db->order('b.position','asc');
        }
        return $this->db->order('b.sort','asc');
    }

    /**
     * @param $view
     * @param $params
     * @param int $isdelete  返回全部商品分页
     */
    public function searchPage(&$view,$params,$isdelete = 0,$position='first'){
        $this->dbList($isdelete,$position,1);
        $this->pageList($view,$params);
    }

}